package com.cube.dp.adapter;

import com.cube.dp.adapter.fs.custom.IFileOperationService;
import com.cube.dp.adapter.fs.third.IThirdPartyFileOperationService;
import com.cube.dp.adapter.fs.third.dto.FileDownloadDto;
import com.cube.dp.adapter.fs.third.dto.FileDownloadForStreamDto;

/**
 * @author litb
 * @date 2022/5/21 17:08
 * <p>
 * 上传时双写,读取时从自研文件服务中读取的适配器
 */
public class DoubleWriteAndReadCustomOperationAdaptor extends AbstractFileDoubleWriteOperationAdaptor {

    public DoubleWriteAndReadCustomOperationAdaptor(IFileOperationService fileOperationService,
                                                    IThirdPartyFileOperationService thirdPartyFileOperationService) {
        super(fileOperationService, thirdPartyFileOperationService);
    }

    @Override
    public FileDownloadDto download(String fileId) {
        return to(getFileOperationService().download(fileId));
    }

    @Override
    public FileDownloadForStreamDto download4Stream(String fileId) {
        return to(getFileOperationService().download4Stream(fileId));
    }
}
